<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="utf-8">
    <title>Bootstrap 101 Template</title>
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <link href="https://cdn.bootcdn.net/ajax/libs/twitter-bootstrap/3.4.1/css/bootstrap.min.css" rel="stylesheet">
    <script src="https://cdn.bootcdn.net/ajax/libs/jquery/3.6.1/jquery.min.js"></script>
    <script src="https://cdn.bootcdn.net/ajax/libs/twitter-bootstrap/3.4.1/js/bootstrap.min.js"></script>
    {% block css %}
    
    {% endblock %}
</head>
<body>
<nav class="navbar navbar-default">
    <div class="container-fluid">
        <!-- Brand and toggle get grouped for better mobile display -->
        <div class="navbar-header">
            <button type="button" class="navbar-toggle collapsed" data-toggle="collapse"
                    data-target="#bs-example-navbar-collapse-1" aria-expanded="false">
                <span class="sr-only">Toggle navigation</span>
                <span class="icon-bar"></span>
                <span class="icon-bar"></span>
                <span class="icon-bar"></span>
            </button>
            <a class="navbar-brand" href="#">{{ blog.site_title }}</a>
        </div>

        <!-- Collect the nav links, forms, and other content for toggling -->
        <div class="collapse navbar-collapse" id="bs-example-navbar-collapse-1">
            <ul class="nav navbar-nav">
                <li class="active"><a href="#">博客<span class="sr-only">(current)</span></a></li>
                <li><a href="#">文章</a></li>
                <li class="dropdown">
                    <a href="#" class="dropdown-toggle" data-toggle="dropdown" role="button" aria-haspopup="true"
                       aria-expanded="false">更多<span class="caret"></span></a>
                    <ul class="dropdown-menu">
                        <li><a href="#">Action</a></li>
                        <li><a href="#">Another action</a></li>
                        <li><a href="#">Something else here</a></li>
                        <li role="separator" class="divider"></li>
                        <li><a href="#">Separated link</a></li>
                        <li role="separator" class="divider"></li>
                        <li><a href="#">One more separated link</a></li>
                    </ul>
                </li>
            </ul>
            <form class="navbar-form navbar-left">
                <div class="form-group">
                    <input type="text" class="form-control" placeholder="Search">
                </div>
                <button type="submit" class="btn btn-default">搜索</button>
            </form>
            <ul class="nav navbar-nav navbar-right">
                {% if request.user.is_authenticated %}
                    <li><a href="#">{{ request.user.username }}</a></li>
                    <li class="dropdown">
                        <a href="#" class="dropdown-toggle" data-toggle="dropdown" role="button" aria-haspopup="true"
                           aria-expanded="false">更多操作<span class="caret"></span></a>
                        <ul class="dropdown-menu">
                            <li><a href="#" data-toggle="modal" data-target=".bs-example-modal-lg">修改密码</a></li>
                            <li><a href="{% url 'set_img' %} ">修改头像</a></li>
                            <li><a href="#">后台管理</a></li>
                            <li role="separator" class="divider"></li>
                            <li><a href="{% url 'logout' %}">退出登录</a></li>
                        </ul>
                        <div class="modal fade  bs-example-modal-lg" tabindex="-1" role="dialog"
                             aria-labelledby="myLargeModalLabel">
                            <div class="modal-dialog modal-lg" role="document">
                                <div class="modal-content">
                                    <h1 class="text-center " style="color: greenyellow">修改密码</h1>
                                    <div class="row">
                                        <div class="col-md-8 col-md-offset-2">
                                            <div class="form-group">
                                                <label for="">用户名</label>
                                                <input type="text" disabled class="form-control" id="username"
                                                       value="{{ request.user.username }}">
                                            </div>
                                            <div class="form-group">
                                                <label for="">原密码</label>
                                                <input type="password" id="old_password" class="form-control">
                                            </div>
                                            <div class="form-group">
                                                <label for="">新密码</label>
                                                <input type="password" id="new_password" class="form-control">
                                            </div>
                                            <div class="form-group">
                                                <label for="">确认密码</label>
                                                <input type="password" id="re_new_password" class="form-control">
                                            </div>
                                            <div style="text-align: center">
                                                <button type="button" class="btn btn-default" data-dismiss="modal">取消
                                                </button>
                                                <button class="btn btn-primary" id="id_edit">修改</button>
                                                <span style="color: red " id="password_error"></span>
                                            </div>
                                            <br>
                                            <br>
                                        </div>
                                    </div>
                                </div>
                            </div>
                        </div>
                        {% else %}
                    <li><a href="{% url 'reg' %}">注册</a></li>
                    <li><a href="{% url 'login' %}">登录</a></li>
                {% endif %}
                </li>
            </ul>
        </div><!-- /.navbar-collapse -->
    </div><!-- /.container-fluid -->
</nav>
<div class="container-fluid">
    <div class="row">
        <div class="col-md-2">
            <div class="bs-example" data-example-id="contextual-panels">
                <div class="panel panel-primary">
                    <div class="panel-heading">
                        <h3 class="panel-title text-center">文章分类</h3>
                    </div>
                    <div class="panel-body text-center ">
                        {% for categroy in categroy_list %}
                        <p><a href="/{{ username }}/category/{{ categroy.2 }}">{{ categroy.0 }}&nbsp;&nbsp;({{ categroy.1 }})</a></p>
                        {% endfor %}

                     </div>
                </div>

                <div class="panel panel-info">
                    <div class="panel-heading">
                        <h3 class="panel-title text-center">文章标签</h3>
                    </div>
                    <div class="panel-body text-center">
                            {% for tag in tag_list %}
                            <p><a href="/{{ username }}/tag/{{ tag.2 }}">{{ tag.0 }}&nbsp;&nbsp;({{ tag.1 }})</a></p>
                            {% endfor %}
                    </div>
                </div>
                <div class="panel panel-warning">
                    <div class="panel-heading">
                        <h3 class="panel-title text-center">日期归档</h3>
                    </div>
                    <div class="panel-body text-center">
                   {% for date in date_list %}
                  <p><a href="/{{ username }}/archive/{{ date.0|date:'Y-m' }}">{{ date.0|date:'Y年m月' }}&nbsp;&nbsp;({{ date.1 }})</a></p>
                   {% endfor %}
                    </div>
                </div>
            </div>
        </div>
    <div class="col-md-10">
    {% block  article %}
    {% for foo in article_list%}
            <div class="media">
                <a href="/{{ username }}/article/{{ foo.pk }}"><h4 class="media-heading">{{ foo.title }}</h4></a>
                <div class="media-left media-middle">
                    <a href="#">
                        <img class="media-object img-circle" src="/media/{{ foo.blog.userinfo.avatar }}" alt="..." width="90px">
                    </a>
                </div>
                <div class="media-body" >
                    <h3></h3>
                    {{ foo.desc }}
                </div>
                <div  style=" float: right;">
                    <span class=" text-right"><a href="">{{ foo.blog.userinfo.username }}&nbsp;&nbsp;</a></span>
                    <span> 发布于&nbsp;&nbsp;</span>
                    <span>{{ foo.create_time|date:'Y-m-d' }}&nbsp;&nbsp;</span>
                    <span><span class="glyphicon glyphicon-comment"> </span>评论{{ foo.comment_num }}&nbsp;&nbsp;</span>
                     <span><span class="glyphicon glyphicon-thumbs-up"> </span>点赞{{ foo.comment_num }}&nbsp;&nbsp;</span>
                </div>
                <hr>
            </div>
            {% endfor %}
    {% endblock %}

    </div>
</div>
</div>
{% block js %}

{% endblock %}
</body>
</html>